﻿using System.Collections.Generic;
using System.Linq;
using Complaint.Models.Dtos;
using Complaint.Repositories;

namespace Complaint.Models
{
    public class OrganisationAliasModel : BaseModel<OrganisationAliasRepository>,
        IModel<OrganisationAlias>
    {
        #region Implementation of IModel<OrganisationAlias>

        public IList<OrganisationAlias> Retrieve()
        {

            return Repository.FindAll().ToList();
        }

        public void Create(OrganisationAlias dto)
        {

            if (dto != null) Repository.Create(dto);
        }

        public void Update(OrganisationAlias dto)
        {

            if (dto != null) Repository.Update(dto);
        }

        public void Delete(OrganisationAlias dto)
        {

            if (dto != null) Repository.Delete(dto);
        }

        public IList<OrganisationAlias> FindByName(string name)
        {

            return Repository.FindByName(name).ToList();
        }

        public OrganisationAlias FindById(int id)
        {

            return Repository.FindById(id);
        }

        #endregion

        public IList<OrganisationAlias> FindByOrganisation(int id)
        {

            return Repository.FindByOrganisation(id).ToList();
        }
    }
}